package org.xukai.remoting.redis;

import redis.clients.jedis.Jedis;
import redis.clients.jedis.Pipeline;
import redis.clients.jedis.Response;

import java.util.List;
import java.util.Set;

/**
 * @author xukai
 * @desc
 * @date 2017-01-02-下午 3:28
 */
public class PiplelineDemo {


    public static void main(String[] args) {
        Jedis jedis = new Jedis("192.168.252.128",6379);
        Pipeline p = jedis.pipelined();
        p.set("fool", "bar");
        p.zadd("foo", 1, "barowitch");  p.zadd("foo", 0, "barinsky"); p.zadd("foo", 0, "barikoviev");
        Response<String> pipeString = p.get("fool");
        Response<Set<String>> sose = p.zrange("foo", 0, -1);
        p.sync();
        List<Object> objects = p.syncAndReturnAll();
        int soseSize = sose.get().size();
        System.out.println(soseSize);
    }

}
